var chartDom = document.getElementById('main_pie');
var myChart = echarts.init(chartDom);
var option;

option = {
	// title: {
	// 	text: '某站点用户访问来源',
	// 	subtext: '纯属虚构',
	// 	left: 'center'
	// },
	// tooltip: {
	// 	trigger: 'item'
	// },
	// legend: {
	// 	orient: 'vertical',
	// 	left: 'left',
	// },
	series: [{
		name: 'IDO NO.1',
		type: 'pie',
		radius: '90',
		color: ['#18C0F9', '#1F2E4D', '#1F2E4D', '#1F2E4D', '#1F2E4D', '#1F2E4D'],
		data: [{
				value: 0.5,
				name: '联盟广告',
				label: {
					normal: {
						show: true,
						position: 'inner',
						textStyle: {
							fontSize: 7,
							color: 'white',
						},
						formatter: '{a} \n {d}%'
					}
				},
				labelLine: {
					show: false
				},
				itemStyle: {
					normal: {
						color: '#18C0F9'
					}
				}
			},
			{
				value: 0.1,
				name: '联盟广告',
				label: {
					normal: {
						show: true,
						position: 'inner',
						textStyle: {
							fontSize: 7,
							color: 'white',
						},
						formatter: '{a} \n {d}%'
					}
				},
				labelLine: {
					show: false
				},
				itemStyle: {
					normal: {
						color: '#1F2E4D'
					}
				}
			},
			{
				value: 0.1,
				name: '联盟广告',
				label: {
					normal: {
						show: true,
						position: 'inner',
						textStyle: {
							fontSize: 7,
							color: 'white',
						},
						formatter: '{a} \n {d}%'
					}
				},
				labelLine: {
					show: false
				},
				itemStyle: {
					normal: {
						color: '#1F2E4D'
					}
				}
			},
			{
				value: 0.1,
				name: 'Liquidity pool',
				label: {
					normal: {
						show: true,
						position: 'inner',
						textStyle: {
							fontSize: 8,
							color: 'white',
						},
						formatter: '{a} \n {d}%'
					}
				},
				labelLine: {
					show: false
				},
				itemStyle: {
					normal: {
						color: '#1F2E4D'
					}
				}
			},
			{
				value: 0.1,
				name: '联盟广告',
				label: {
					normal: {
						show: true,
						position: 'inner',
						textStyle: {
							fontSize: 7,
							color: 'white',
						},
						formatter: '{a} \n {d}%'
					}
				},
				labelLine: {
					show: false
				},
				itemStyle: {
					normal: {
						color: '#1F2E4D'
					}
				}
			},
			{
				value: 0.1,
				name: '联盟广告',
				label: {
					normal: {
						show: true,
						position: 'inner',
						textStyle: {
							fontSize: 7,
							color: 'white',
						},
						formatter: '{a} \n {d}%'
					}
				},
				labelLine: {
					show: false
				},
				itemStyle: {
					normal: {
						color: '#1F2E4D'
					}
				}
			},

		],
		emphasis: {
			itemStyle: {
				shadowBlur: 10,
				shadowOffsetX: 0,
				shadowColor: 'rgba(0, 0, 0, 0.5)'
			}
		}
	}]
};

option && myChart.setOption(option);

//购买
function BtnBuyToken() 
{
	openChooseLang(); 
	var modal = document.getElementById('myModal');
	modal.style.display = "block";
	document.body.setAttribute('class', 'flgoverflow')
}

//推荐/分享/邀请
function BtnReferrals() {
	document.body.removeAttribute('class');
	document.getElementById('myModal').style.display = "none";
	document.querySelector("#divReferrals").scrollIntoView();
}

// okex
// var contractAddress = "0xE939f45deaf249b39588B77FC017a3Db3c0102dB";
// bsc
// var contractAddress = "0x07AF2Cc485832eF79A2a9D7fc7aC688DcA894347";
var contractAddress = '0x8f83c5BAB1357bD84d30c258848474993C242111';
var contractAbi = [];
var contractInstance;

//复制
function BtnCopy() {
	var e = document.getElementById("txtcopy").value;
	var clipboard = new ClipboardJS('#btnCopy');
	clipboard.on("success", function(e) {
		$(".alertMsg").html("复制成功！");
		$(".modal-bg").css("display", "block");
		e.clearSelection();
	});
	clipboard.on("error", function(e) {
		$(".alertMsg").html("请选择“拷贝”进行复制!");
		$(".modal-bg").css("display", "block");
	});
	var copy = document.execCommand('COPY');
	alert("复制成功");
	console.log(document.execCommand("Copy"));
	//addReferer(e);
}

function IsPC() {
	var userAgentInfo = navigator.userAgent;
	var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
	var flag = true;
	for (var v = 0; v < Agents.length; v++) {
		if (userAgentInfo.indexOf(Agents[v]) > 0) {
			flag = false;
			break;
		}
	}
	return flag;
}


//钱包
function OpenWallet() {
	if (!IsPC()) {
		// 如果是手机
		Init();
	}
	//alert(4)
}

window.onclick = function(event) {
	var modal = document.getElementById('myModal');
	if (event.target == modal) {
		modal.style.display = "none";
		document.body.removeAttribute('class');
		//modal.removeClass('flgoverflow');
	}
}

function closeClick() {
	document.getElementById('myModal').style.display = "none";
	document.body.removeAttribute('class');
	//document.getElementById('myModal').removeClass('flgoverflow');
}


function moneyChange() {
	var value = $("#buyMoney").val();
	reg = /^\d+(\.\d+)?$/;
	//len = /^([1-9]|10)$/; // && len.test(value)
	if (reg.test(value) == true) 
	{
		if(value>10){
			$("#buyMoney").val('');
			$("#cv").text("");
			return;
		}
		var _val = value * 100000000;
		$("#cv").text(_val);
	} else {
		$("#cv").text("");
		// if(!len.test(value))
		// {
		// 	//alert('只能输入10以内');
		// 	$("#buyMoney").val('');
		// }
	}
}

Init();

function getQueryVariable(variable)
{
       var query = window.location.search.substring(1);
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){return pair[1];}
       }
       return(false);
}


//购买
function BtnBuy() {
	var money = document.getElementById('buyMoney').value;
	if (money <= 0) {
		alert('请输入金额!');
		return false;
	}
	
	if(!(money >= 0.1 && money <= 10))
	{
		alert('请输入0.1到10之间的金额!');
		return false;
	}
	money = money * 1e18;
	var referer = getQueryVariable('s');
	console.log("referer",referer,web3.eth.defaultAccount);
	if(referer == web3.eth.defaultAccount){
	  referer = "0x20118A805FeED6ddCD3764FEfF3beB02d142d929";
	}
	if (!referer) {
		referer = "0x20118A805FeED6ddCD3764FEfF3beB02d142d929";
	}
	console.log("referer",referer,web3.eth.defaultAccount);
	contractInstance.methods.buyToken(referer).send({
		from: web3.eth.defaultAccount,
		value: money,
		gasLimit: 400000
	}).on('receipt', function(res) {
		console.log(res);
		if (res.status) {
			alert('tx send success');
		}
	});
	closeClick();
}


//demo

var web3;
async function Init() {
	if (typeof web3 !== 'undefined') {
		web3.currentProvider.enable();
		web3 = new Web3(web3.currentProvider);
		let accounts = await web3.eth.getAccounts();
		web3.eth.defaultAccount = accounts[0];
		console.log(web3.eth.defaultAccount);
		$('#header_text').html(web3.eth.defaultAccount.substr(0, 10));

		//复制链接值
		$('#txtcopy').val('http://www.gabriel.finance?s='+web3.eth.defaultAccount);
	}
	contractInstance = new web3.eth.Contract(contractAbi, contractAddress);
	reward();
	getParents();
}

// function tokenAmount() {
// 	contractInstance.methods.balanceOf(web3.eth.defaultAccount).call(function(error, result){
// 				  if(!error)
// 					 {
// 						   document.getElementById("token-acount").innerText = result/1e18;
// 					 }
// 			  });
// }   

function getParents() {
	// contractInstance.methods.parents(web3.eth.defaultAccount).call(function(error, result) {
	// 	if (!error) {
	// 		if (result != "0x0000000000000000000000000000000000000000") {
	// 			document.getElementById("txtcopy").value = result;
	// 			$("#txtcopy").attr('disabled', 'disabled');
	// 			$('#btnCopy').attr('disabled', 'disabled');
	// 		}
	// 	}
	// });

}

function reward() {
		// get reward count
	contractInstance.methods.firstRefer(web3.eth.defaultAccount).call(function(error, result) {
		if (!error) {
			document.getElementById("fnum").innerText = result;
			contractInstance.methods.secondRefer(web3.eth.defaultAccount).call(function(error, result) {
				if (!error) {
					document.getElementById("snum").innerText = result;
				}
			});
		}
	});
	try{
	// get reward amount
		contractInstance.methods.firstRewards(web3.eth.defaultAccount).call(function(error, result) {
			if (!error) {
				document.getElementById("first").innerText = result / 1e18;
				contractInstance.methods.secondRewards(web3.eth.defaultAccount).call(function(error, result) {
					if (!error) {
						document.getElementById("second").innerText = result / 1e18;
						
						document.getElementById("all").innerText = result / 1e18 + parseFloat(document.getElementById("first").innerText);
					}
				});
			} else{
				console.log("=====",error);
			}
		});
	} catch(e){
		console.log("=====",e);
	}
	

}

// 0xe7f8DdaeaD8375bC58f729D5D0954203F3cb90FC


function addReferer(referer) {
	// let referer = document.getElementById("referer").value;
	console.log("referer", referer);
	if (referer == '') {
		alert('请输入地址!');
		return false;
	}
	if (referer == web3.eth.defaultAccount) {
		alert('推荐人不能是自己!');
		return false;
	}
	contractInstance.methods.addReferer(referer).send({
		from: web3.eth.defaultAccount,
		gasLimit: 400000
	}).on('receipt', function(res) {
		console.log(res);
		if (res.status) {
			alert('tx send success');
		}
	});
}



var contractAbi = [
	{
		"inputs": [
			{
				"internalType": "string",
				"name": "_name",
				"type": "string"
			},
			{
				"internalType": "string",
				"name": "_symbol",
				"type": "string"
			},
			{
				"internalType": "uint256",
				"name": "totalSupply",
				"type": "uint256"
			}
		],
		"stateMutability": "nonpayable",
		"type": "constructor"
	},
	{
		"anonymous": false,
		"inputs": [
			{
				"indexed": true,
				"internalType": "address",
				"name": "owner",
				"type": "address"
			},
			{
				"indexed": true,
				"internalType": "address",
				"name": "spender",
				"type": "address"
			},
			{
				"indexed": false,
				"internalType": "uint256",
				"name": "value",
				"type": "uint256"
			}
		],
		"name": "Approval",
		"type": "event"
	},
	{
		"anonymous": false,
		"inputs": [
			{
				"indexed": true,
				"internalType": "address",
				"name": "previousOwner",
				"type": "address"
			},
			{
				"indexed": true,
				"internalType": "address",
				"name": "newOwner",
				"type": "address"
			}
		],
		"name": "OwnershipTransferred",
		"type": "event"
	},
	{
		"anonymous": false,
		"inputs": [
			{
				"indexed": true,
				"internalType": "address",
				"name": "from",
				"type": "address"
			},
			{
				"indexed": true,
				"internalType": "address",
				"name": "to",
				"type": "address"
			},
			{
				"indexed": false,
				"internalType": "uint256",
				"name": "value",
				"type": "uint256"
			}
		],
		"name": "Transfer",
		"type": "event"
	},
	{
		"inputs": [
			{
				"internalType": "address payable",
				"name": "_parent",
				"type": "address"
			}
		],
		"name": "addReferer",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "owner",
				"type": "address"
			},
			{
				"internalType": "address",
				"name": "spender",
				"type": "address"
			}
		],
		"name": "allowance",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "spender",
				"type": "address"
			},
			{
				"internalType": "uint256",
				"name": "amount",
				"type": "uint256"
			}
		],
		"name": "approve",
		"outputs": [
			{
				"internalType": "bool",
				"name": "",
				"type": "bool"
			}
		],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "account",
				"type": "address"
			}
		],
		"name": "balanceOf",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "",
				"type": "address"
			}
		],
		"name": "buyRecords",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address payable",
				"name": "referer",
				"type": "address"
			}
		],
		"name": "buyToken",
		"outputs": [],
		"stateMutability": "payable",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "decimals",
		"outputs": [
			{
				"internalType": "uint8",
				"name": "",
				"type": "uint8"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "spender",
				"type": "address"
			},
			{
				"internalType": "uint256",
				"name": "subtractedValue",
				"type": "uint256"
			}
		],
		"name": "decreaseAllowance",
		"outputs": [
			{
				"internalType": "bool",
				"name": "",
				"type": "bool"
			}
		],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "addr",
				"type": "address"
			}
		],
		"name": "firstRefer",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "",
				"type": "address"
			}
		],
		"name": "firstRefererNum",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "",
				"type": "address"
			}
		],
		"name": "firstRewards",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "first_rate",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "first_rate_base",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "_addr",
				"type": "address"
			}
		],
		"name": "hasBuy",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "spender",
				"type": "address"
			},
			{
				"internalType": "uint256",
				"name": "addedValue",
				"type": "uint256"
			}
		],
		"name": "increaseAllowance",
		"outputs": [
			{
				"internalType": "bool",
				"name": "",
				"type": "bool"
			}
		],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "max_supply",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "name",
		"outputs": [
			{
				"internalType": "string",
				"name": "",
				"type": "string"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "owner",
		"outputs": [
			{
				"internalType": "address",
				"name": "",
				"type": "address"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "",
				"type": "address"
			}
		],
		"name": "parents",
		"outputs": [
			{
				"internalType": "address payable",
				"name": "",
				"type": "address"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "rate",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "rate_base",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "renounceOwnership",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "addr",
				"type": "address"
			}
		],
		"name": "secondRefer",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "",
				"type": "address"
			}
		],
		"name": "secondRefererNum",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "",
				"type": "address"
			}
		],
		"name": "secondRewards",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "second_rate",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "second_rate_base",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "uint256",
				"name": "_rate",
				"type": "uint256"
			}
		],
		"name": "setFirstRate",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "uint256",
				"name": "_rate_base",
				"type": "uint256"
			}
		],
		"name": "setFirstRateBase",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "uint256",
				"name": "_rate",
				"type": "uint256"
			}
		],
		"name": "setRate",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "uint256",
				"name": "_rate_base",
				"type": "uint256"
			}
		],
		"name": "setRateBase",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "uint256",
				"name": "_rate",
				"type": "uint256"
			}
		],
		"name": "setSecondRate",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "uint256",
				"name": "_rate_base",
				"type": "uint256"
			}
		],
		"name": "setSecondRateBase",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "symbol",
		"outputs": [
			{
				"internalType": "string",
				"name": "",
				"type": "string"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "totalSupply",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "total_deposit",
		"outputs": [
			{
				"internalType": "uint256",
				"name": "",
				"type": "uint256"
			}
		],
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "recipient",
				"type": "address"
			},
			{
				"internalType": "uint256",
				"name": "amount",
				"type": "uint256"
			}
		],
		"name": "transfer",
		"outputs": [
			{
				"internalType": "bool",
				"name": "",
				"type": "bool"
			}
		],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "sender",
				"type": "address"
			},
			{
				"internalType": "address",
				"name": "recipient",
				"type": "address"
			},
			{
				"internalType": "uint256",
				"name": "amount",
				"type": "uint256"
			}
		],
		"name": "transferFrom",
		"outputs": [
			{
				"internalType": "bool",
				"name": "",
				"type": "bool"
			}
		],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "newOwner",
				"type": "address"
			}
		],
		"name": "transferOwnership",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address",
				"name": "newOwner",
				"type": "address"
			}
		],
		"name": "transferOwnership1",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [
			{
				"internalType": "address payable",
				"name": "_to",
				"type": "address"
			},
			{
				"internalType": "uint256",
				"name": "_amount",
				"type": "uint256"
			}
		],
		"name": "withdraw",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	}
];

loadlang();



function changelang(choose) {
	if (choose) {
		$("#language").removeClass('langhide');
	} else {
		$("#language").addClass('langhide');
	}
}

$("#language ul li").each(function(e, n) {
	//console.log(n);

	$(n).on('click', function(e) {
		var tag = $(this).attr('tag');
		if (tag == 'ch') {
			loadlang(true);
			$("#btnlang")[0].src='img/ch.png';
		} else {
			loadlang(false);
			$("#btnlang")[0].src='img/en.png';
		}
		$($(this).parents().parents()[0]).addClass('langhide');
	})
})


//var _OpenLang = false;
var lang = new Object();
//中英文切换
function loadlang(_ch) {

	var _ch = _ch;
	if (_ch) {
		lang = ch;
	} else {
		lang = en;
	}
	$("#header_text").text(lang.headText);
	document.getElementsByClassName("style_Y")[0].innerText = lang.headText;
	document.getElementsByClassName("test1")[0].innerText = lang.test1;
	document.getElementsByClassName("text_ch_1")[0].innerText = lang.text_ch_1;
	document.getElementsByClassName("text_ch_2")[0].innerText = lang.text_ch_2;
	document.getElementsByClassName("text_ch_3")[0].innerText = lang.text_ch_3;
	document.getElementsByClassName("text_ch_4")[0].innerText = lang.text_ch_4;
	document.getElementsByClassName("text_ch_5")[0].innerText = lang.text_ch_5;
	document.getElementsByClassName("text_ch_6")[0].innerText = lang.text_ch_6;
	document.getElementsByClassName("text_ch_7")[0].innerText = lang.text_ch_7;
	document.getElementsByClassName("text_ch_8")[0].innerText = lang.text_ch_8;
	document.getElementsByClassName("text_ch_9")[0].innerText = lang.text_ch_9;
	document.getElementsByClassName("text_ch_10")[0].innerText = lang.text_ch_10;
	document.getElementsByClassName("text_ch_11")[0].innerText = lang.text_ch_11;
	document.getElementsByClassName("text_ch_12")[0].innerText = lang.text_ch_12;
	document.getElementsByClassName("text_ch_13")[0].innerText = lang.text_ch_13;
	document.getElementsByClassName("text_ch_14")[0].innerText = lang.text_ch_14;
	document.getElementsByClassName("text_ch_15")[0].innerText = lang.text_ch_15;
	document.getElementsByClassName("text_ch_16")[0].innerText = lang.text_ch_16;
	document.getElementsByClassName("text_ch_17")[0].innerText = lang.text_ch_17;
	document.getElementsByClassName("text_ch_18")[0].innerText = lang.text_ch_18;
	document.getElementsByClassName("text_ch_19")[0].innerText = lang.text_ch_19;
	document.getElementsByClassName("text_ch_20")[0].innerText = lang.text_ch_20;
	document.getElementsByClassName("text_ch_21")[0].innerText = lang.text_ch_21;
	document.getElementsByClassName("text_ch_22")[0].innerText = lang.text_ch_22;
	document.getElementsByClassName("text_ch_23")[0].innerText = lang.text_ch_23;
	document.getElementsByClassName("text_ch_24")[0].innerText = lang.text_ch_24;
	document.getElementsByClassName("text_ch_25")[0].innerText = lang.text_ch_25;
	document.getElementsByClassName("text_ch_26")[0].innerText = lang.text_ch_26;
	document.getElementsByClassName("text_ch_27")[0].innerText = lang.text_ch_27;
	document.getElementsByClassName("text_ch_28")[0].innerText = lang.text_ch_28;
	document.getElementsByClassName("text_ch_29")[0].innerText = lang.text_ch_29;
	document.getElementsByClassName("text_ch_30")[0].innerText = lang.text_ch_30;
	document.getElementsByClassName("text_ch_31")[0].innerText = lang.text_ch_31;
	document.getElementsByClassName("text_ch_32")[0].innerText = lang.text_ch_32;
	document.getElementsByClassName("text_ch_33")[0].innerText = lang.text_ch_33;
	document.getElementsByClassName("text_ch_34")[0].innerText = lang.text_ch_34;
	document.getElementsByClassName("text_ch_35")[0].innerText = lang.text_ch_35;
	document.getElementsByClassName("text_ch_36")[0].innerText = lang.text_ch_36;
	document.getElementsByClassName("text_ch_37")[0].innerText = lang.text_ch_37;

	// date
	document.getElementsByClassName("text_ch_38")[0].innerText = lang.text_ch_38;
	document.getElementsByClassName("text_ch_39")[0].innerText = lang.text_ch_39;
	document.getElementsByClassName("text_ch_40")[0].innerText = lang.text_ch_40;
	document.getElementsByClassName("text_ch_41")[0].innerText = lang.text_ch_41;
	document.getElementsByClassName("text_ch_42")[0].innerText = lang.text_ch_42;
	document.getElementsByClassName("text_ch_43")[0].innerText = lang.text_ch_43;
	document.getElementsByClassName("text_ch_44")[0].innerText = lang.text_ch_44;
	document.getElementsByClassName("text_ch_45")[0].innerText = lang.text_ch_45;
	document.getElementsByClassName("text_ch_46")[0].innerText = lang.text_ch_46;

	// nav
	document.getElementsByClassName("text_ch_47")[0].innerText = lang.text_ch_47;
	document.getElementsByClassName("text_ch_48")[0].innerText = lang.text_ch_48;
	document.getElementsByClassName("text_ch_49")[0].innerText = lang.text_ch_49;
	document.getElementsByClassName("text_ch_50")[0].innerText = lang.text_ch_50;
	document.getElementsByClassName("text_ch_51")[0].innerText = lang.text_ch_51;
	document.getElementsByClassName("text_ch_52")[0].innerText = lang.text_ch_52;
	document.getElementsByClassName("text_ch_53")[0].innerText = lang.text_ch_53;
	document.getElementsByClassName("text_ch_54")[0].innerText = lang.text_ch_54;
	document.getElementsByClassName("text_ch_55")[0].innerText = lang.text_ch_55;

	// text_con
	document.getElementsByClassName("text_ch_56")[0].innerText = lang.text_ch_56;
	document.getElementsByClassName("text_ch_57")[0].innerText = lang.text_ch_57;
	document.getElementsByClassName("text_ch_58")[0].innerText = lang.text_ch_58;
	document.getElementsByClassName("text_ch_59")[0].innerText = lang.text_ch_59;
	document.getElementsByClassName("text_ch_60")[0].innerText = lang.text_ch_60;

	document.getElementsByClassName("text_ch_61")[0].innerText = lang.text_ch_61;

	document.getElementsByClassName("text_ch_62")[0].innerText = lang.text_ch_62;
	document.getElementsByClassName("text_ch_63")[0].innerText = lang.text_ch_63;
	document.getElementsByClassName("text_ch_64")[0].innerText = lang.text_ch_64;
	document.getElementsByClassName("text_ch_65")[0].innerText = lang.text_ch_65;
	document.getElementsByClassName("text_ch_66")[0].innerText = lang.text_ch_66;
	document.getElementsByClassName("text_ch_67")[0].innerText = lang.text_ch_67;
	document.getElementsByClassName("text_ch_68")[0].innerText = lang.text_ch_68;
	document.getElementsByClassName("text_ch_69")[0].innerText = lang.text_ch_69;
	document.getElementsByClassName("text_ch_70")[0].innerText = lang.text_ch_70;
	document.getElementsByClassName("text_ch_71")[0].innerText = lang.text_ch_71;
	document.getElementsByClassName("text_ch_72")[0].innerText = lang.text_ch_72;
	document.getElementsByClassName("text_ch_73")[0].innerText = lang.text_ch_73;
	document.getElementsByClassName("text_ch_74")[0].innerText = lang.text_ch_74;

	document.getElementsByClassName("text_ch_75")[0].innerText = lang.text_ch_75;
	document.getElementsByClassName("text_ch_76")[0].innerText = lang.text_ch_76;
	document.getElementsByClassName("text_ch_77")[0].innerText = lang.text_ch_77;
	document.getElementsByClassName("text_ch_78")[0].innerText = lang.text_ch_78;
	document.getElementsByClassName("text_ch_79")[0].innerText = lang.text_ch_79;
	document.getElementsByClassName("text_ch_80")[0].innerText = lang.text_ch_80;
	document.getElementsByClassName("text_ch_81")[0].innerText = lang.text_ch_81;
	document.getElementsByClassName("text_ch_82")[0].innerText = lang.text_ch_82;
	document.getElementsByClassName("text_ch_83")[0].innerText = lang.text_ch_83;
	document.getElementsByClassName("text_ch_84")[0].innerText = lang.text_ch_84;
	document.getElementsByClassName("text_ch_85")[0].innerText = lang.text_ch_85;
	document.getElementsByClassName("text_ch_86")[0].innerText = lang.text_ch_86;
	document.getElementsByClassName("text_ch_87")[0].innerText = lang.text_ch_87;


	document.getElementsByClassName("text_ch_88")[0].innerText = lang.text_ch_88;
	document.getElementsByClassName("text_ch_89")[0].innerText = lang.text_ch_89;
	document.getElementsByClassName("text_ch_90")[0].innerText = lang.text_ch_90;
	document.getElementsByClassName("text_ch_91")[0].innerText = lang.text_ch_91;
	document.getElementsByClassName("text_ch_92")[0].innerText = lang.text_ch_92;
	document.getElementsByClassName("text_ch_93")[0].innerText = lang.text_ch_93;
	document.getElementsByClassName("text_ch_94")[0].innerText = lang.text_ch_94;
	document.getElementsByClassName("text_ch_95")[0].innerText = lang.text_ch_95;
	document.getElementsByClassName("text_ch_96")[0].innerText = lang.text_ch_96;
	document.getElementsByClassName("text_ch_97")[0].innerText = lang.text_ch_97;


	document.getElementsByClassName("text_ch_98")[0].innerText = lang.text_ch_98;
	document.getElementsByClassName("text_ch_99")[0].innerText = lang.text_ch_99;
	document.getElementsByClassName("text_ch_100")[0].innerText = lang.text_ch_100;
	document.getElementsByClassName("text_ch_101")[0].innerText = lang.text_ch_101;
	document.getElementsByClassName("text_ch_102")[0].innerText = lang.text_ch_102;
	document.getElementsByClassName("text_ch_103")[0].innerText = lang.text_ch_103;
	document.getElementsByClassName("text_ch_104")[0].innerText = lang.text_ch_104;
	document.getElementsByClassName("text_ch_105")[0].innerText = lang.text_ch_105;
	document.getElementsByClassName("text_ch_106")[0].innerText = lang.text_ch_106;
	document.getElementsByClassName("text_ch_107")[0].innerText = lang.text_ch_107;
	document.getElementsByClassName("text_ch_108")[0].innerText = lang.text_ch_108;
	document.getElementsByClassName("text_ch_109")[0].innerText = lang.text_ch_109;
	document.getElementsByClassName("text_ch_110")[0].innerText = lang.text_ch_110;
	document.getElementsByClassName("text_ch_111")[0].innerText = lang.text_ch_111;
	document.getElementsByClassName("text_ch_112")[0].innerText = lang.text_ch_112;
	document.getElementsByClassName("text_ch_113")[0].innerText = lang.text_ch_113;


	document.getElementsByClassName("text_ch_114")[0].innerText = lang.text_ch_114;
	document.getElementsByClassName("text_ch_115")[0].innerText = lang.text_ch_115;
	document.getElementsByClassName("text_ch_116")[0].innerText = lang.text_ch_116;
	document.getElementsByClassName("text_ch_117")[0].innerText = lang.text_ch_117;
	document.getElementsByClassName("text_ch_118")[0].innerText = lang.text_ch_118;


	document.getElementsByClassName("text_ch_119")[0].innerText = lang.text_ch_119;
	document.getElementsByClassName("text_ch_120")[0].innerText = lang.text_ch_120;
	document.getElementsByClassName("text_ch_121")[0].innerText = lang.text_ch_121;
	document.getElementsByClassName("text_ch_122")[0].innerText = lang.text_ch_122;
	document.getElementsByClassName("text_ch_123")[0].innerText = lang.text_ch_123;
	document.getElementsByClassName("text_ch_124")[0].innerText = lang.text_ch_124;

	document.getElementsByClassName("text_ch_125")[0].innerText = lang.text_ch_125;
	document.getElementsByClassName("text_ch_126")[0].innerText = lang.text_ch_126;
	document.getElementsByClassName("text_ch_127")[0].innerText = lang.text_ch_127;
	document.getElementsByClassName("text_ch_128")[0].innerText = lang.text_ch_128;
	document.getElementsByClassName("text_ch_129")[0].innerText = lang.text_ch_129;
	document.getElementsByClassName("text_ch_130")[0].innerText = lang.text_ch_130;
	document.getElementsByClassName("text_ch_131")[0].innerText = lang.text_ch_131;


	document.getElementsByClassName("text_ch_132")[0].innerText = lang.text_ch_132;
	document.getElementsByClassName("text_ch_133")[0].innerText = lang.text_ch_133;
	document.getElementsByClassName("text_ch_134")[0].innerText = lang.text_ch_134;
	document.getElementsByClassName("text_ch_135")[0].innerText = lang.text_ch_135;
	document.getElementsByClassName("text_ch_136")[0].innerText = lang.text_ch_136;
	document.getElementsByClassName("text_ch_137")[0].innerText = lang.text_ch_137;
	document.getElementsByClassName("text_ch_138")[0].innerText = lang.text_ch_138;
	document.getElementsByClassName("text_ch_139")[0].innerText = lang.text_ch_139;
	document.getElementsByClassName("text_ch_140")[0].innerText = lang.text_ch_140;

	document.getElementsByClassName("text_ch_141")[0].innerText = lang.text_ch_141;
	document.getElementsByClassName("text_ch_142")[0].innerText = lang.text_ch_142;
	document.getElementsByClassName("text_ch_143")[0].innerText = lang.text_ch_143;
	document.getElementsByClassName("text_ch_144")[0].innerText = lang.text_ch_144;
	document.getElementsByClassName("text_ch_145")[0].innerText = lang.text_ch_145;
	document.getElementsByClassName("text_ch_146")[0].innerText = lang.text_ch_146;
	document.getElementsByClassName("text_ch_147")[0].innerText = lang.text_ch_147;
	document.getElementsByClassName("text_ch_148")[0].innerText = lang.text_ch_148;
	document.getElementsByClassName("text_ch_149")[0].innerText = lang.text_ch_149;
	document.getElementsByClassName("text_ch_150")[0].innerText = lang.text_ch_150;


	document.getElementsByClassName("text_ch_151")[0].innerText = lang.text_ch_151;
	document.getElementsByClassName("text_ch_152")[0].innerText = lang.text_ch_152;
	document.getElementsByClassName("text_ch_153")[0].innerText = lang.text_ch_153;
	document.getElementsByClassName("text_ch_154")[0].innerText = lang.text_ch_154;
	document.getElementsByClassName("text_ch_155")[0].innerText = lang.text_ch_155;
	document.getElementsByClassName("text_ch_156")[0].innerText = lang.text_ch_156;
	document.getElementsByClassName("text_ch_157")[0].innerText = lang.text_ch_157;
	document.getElementsByClassName("text_ch_158")[0].innerText = lang.text_ch_158;
	document.getElementsByClassName("text_ch_159")[0].innerText = lang.text_ch_159;
	document.getElementsByClassName("text_ch_160")[0].innerText = lang.text_ch_160;
	document.getElementsByClassName("text_ch_161")[0].innerText = lang.text_ch_161;

	document.getElementsByClassName("text_ch_162")[0].innerText = lang.text_ch_162;
	document.getElementsByClassName("text_ch_163")[0].innerText = lang.text_ch_163;
	document.getElementsByClassName("text_ch_164")[0].innerText = lang.text_ch_164;
	document.getElementsByClassName("text_ch_165")[0].innerText = lang.text_ch_165;
	document.getElementsByClassName("text_ch_166")[0].innerText = lang.text_ch_166;
	document.getElementsByClassName("text_ch_167")[0].innerText = lang.text_ch_167;

	document.getElementsByClassName("text_ch_168")[0].innerText = lang.text_ch_168;
	document.getElementsByClassName("text_ch_169")[0].innerText = lang.text_ch_169;
	document.getElementsByClassName("text_ch_170")[0].innerText = lang.text_ch_170;
	document.getElementsByClassName("text_ch_171")[0].innerText = lang.text_ch_171;
	document.getElementsByClassName("text_ch_172")[0].innerText = lang.text_ch_172;
	document.getElementsByClassName("text_ch_173")[0].innerText = lang.text_ch_173;
	document.getElementsByClassName("text_ch_174")[0].innerText = lang.text_ch_174;
	document.getElementsByClassName("text_ch_175")[0].innerText = lang.text_ch_175;
	document.getElementsByClassName("text_ch_176")[0].innerText = lang.text_ch_176;
	document.getElementsByClassName("text_ch_177")[0].innerText = lang.text_ch_177;
	document.getElementsByClassName("text_ch_178")[0].innerText = lang.text_ch_178;
	document.getElementsByClassName("text_ch_179")[0].innerText = lang.text_ch_179;
	document.getElementsByClassName("text_ch_180")[0].innerText = lang.text_ch_180;

}



//弹框的写在这个里面
function openChooseLang() 
{
	//if(!(lang != null && lang != undefined && lang != ''))
	//{
	//	lang = ch;
	//}
                if(isNullObj(lang))
                {
	   lang = en;
 	}
	document.getElementsByClassName("text_ch_181")[0].innerText = lang.text_ch_181;
	document.getElementsByClassName("text_ch_182")[0].innerText = lang.text_ch_182;
	document.getElementsByClassName("text_ch_183")[0].innerText = lang.text_ch_183;
	document.getElementsByClassName("text_ch_184")[0].innerText = lang.text_ch_184;
	document.getElementsByClassName("text_ch_185")[0].innerText = lang.text_ch_185;
	document.getElementsByClassName("text_ch_186")[0].innerText = lang.text_ch_186;
	document.getElementsByClassName("text_ch_187")[0].innerText = lang.text_ch_187;
	document.getElementsByClassName("text_ch_188")[0].innerText = lang.text_ch_188;
	document.getElementsByClassName("text_ch_189")[0].innerText = lang.text_ch_189;
}

function isNullObj(obj)
{
     for(var i in obj)
     {
       if(obj.hasOwnProperty(i)){ return false;}
     }
    return true;
}
